function convertKey(arr, key) {
  let newArr = [];
  arr.forEach((item, index) => {
    let newObj = {};
    for (var i = 0; i < key.length; i++) {
      newObj[key[i]] = item[Object.keys(item)[i]];
    }
    newArr.push(newObj);
  });
  console.log(newArr);
  return newArr;
}
// 机电系统工程合格率;
$.ajax({
  type: "get",
  async: true, //异步执行
  url: base_url + "/systemItemEffectivePercent",
  dataType: "json", //返回数据形式为json
  success: function (data) {
    if (data.code == 1000) {
      if (data.data !== null) {
        electromechanicalSystemData = data.data.dataList;
        if (Object.keys(data.data).length !== 0) {
          $(".electromechanicalSystem_min").text(data.data.min);
          if (electromechanicalSystemData.length !== 0) {
            decorationInstallationComEchart();
          } else {
            $(".electromechanicalSystemChart").html(
              "<div class='noData'>今日暂无数据</div>"
            );
          }
        } else {
          $(".electromechanicalSystemChart").html(
            "<div class='noData'>今日暂无数据</div>"
          );
        }
      } else {
        $(".electromechanicalSystemChart").html(
          "<div class='noData'>今日暂无数据</div>"
        );
      }
    } else {
      alert(data.message);
    }
    //   fn();
  },
  error: function (errorMsg) {
    console.log("请求数据失败");
  },
});
// 土建工程完成率
civilEngineeringCompletioRateEchart();
function civilEngineeringCompletioRateEchart() {
  let civilEngineeringCompletioRateE = document.getElementsByClassName(
    "civilEngineeringCompletioRateEchart"
  );
  for (var i = 0; i < civilEngineeringCompletioRateE.length; i++) {
    let myChart = echarts.init(civilEngineeringCompletioRateE[i]);
    var color = new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      {
        offset: 0,
        color: "#D8FD36",
      },
      {
        offset: 1,
        color: "#2AFD85",
      },
    ]);
    var fourPieData = [
      {
        name: "10号线二期",
        value: 100,
      },
      {
        name: "14号线",
        value: 71.12,
      },
      {
        name: "15号线",
        value: 100,
      },
      {
        name: "18号线",
        value: 79,
      },
    ];
    var titleArr = [],
      seriesArr = [];
    fourPieData.forEach(function (item, index) {
      seriesArr.push(
        {
          name: "完成率",
          type: "gauge",
          startAngle: 200,
          endAngle: -20,
          min: 0,
          max: 100,
          radius: "42%",
          center: [
            index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
            index < 2 ? "30%" : "80%",
          ],
          axisLine: {
            show: true,
            lineStyle: {
              color: [
                [
                  100,
                  new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                    {
                      offset: 0,
                      color: "#FB3F52",
                    },
                    {
                      offset: 1,
                      color: "#3BF37A",
                    },
                  ]),
                ],
                [1, "rgba(225,225,225,0.4)"],
              ],
              width: 3,
              opacity: 1,
            },
          },
          title: {
            show: false,
          },
          detail: {
            show: true,
            offsetCenter: [0, "55%"],
            color: "#D6F1FF",
            fontSize: 14,
            formatter: ["{value}%\n " + "{name|" + item.name + "}"].join("\n"),
            rich: {
              value: {
                fontSize: 14,
                color: "#FFDE00",
              },
              unit: {
                fontSize: 16,
                color: "#FFDE00",
              },
            },
          },
          axisTick: {
            length: 0,
            splitNumber: 2,
            lineStyle: {
              color: "#999",
            },
          },
          splitLine: {
            length: 7,
            lineStyle: {
              color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                {
                  offset: 0,
                  color: "#FB3F52",
                },
                {
                  offset: 1,
                  color: "#3BF37A",
                },
              ]),
            },
          },
          axisLabel: {
            color: "#D6F1FF",
            fontSize: 12,
          },
          pointer: {
            width: 7,
            length: 40,
          },
          itemStyle: {
            color: color,
            shadowColor: "rgba(0,138,255,0.45)",
            shadowBlur: 10,
            shadowOffsetX: 2,
            shadowOffsetY: 2,
          },
          markPoint: {
            data: [
              {
                x: index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                y: index < 2 ? "30%" : "80%",
                symbol: "circle",
                symbolSize: 20,
                itemStyle: {
                  color: color,
                },
              },
              {
                x: index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                y: index < 2 ? "30%" : "80%",
                symbol: "circle",
                symbolSize: 6,
                itemStyle: {
                  color: "#fff",
                },
              },
            ],
          },
          data: [
            {
              value: item.value,
              name: "完成率",
            },
          ],
        },
        {
          name: "已完成数",
          type: "gauge",
          radius: "55%",
          center: [
            index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
            index < 2 ? "30%" : "80%",
          ],
          startAngle: 200,
          endAngle: -20,
          min: 0,
          max: 100,
          title: {
            show: false,
          },
          detail: {
            show: false,
          },
          axisLine: {
            show: true,
            lineStyle: {
              width: 18,
              color: [
                [item.value / 100, color],
                [1, "#35375C"],
              ],
              // shadowColor: 'rgba(0,138,255,0.35)',
              // shadowBlur: 5,
            },
          },
          axisTick: {
            show: true,
            length: 18,
            splitNumber: 2,
            lineStyle: {
              color: "#192568",
              width: 3,
            },
          },
          splitLine: {
            show: false,
          },
          axisLabel: {
            show: false,
          },
          pointer: {
            show: false,
          },
          itemStyle: {
            normal: {
              color: "#35375C",
            },
          },
          data: [
            {
              value: item.value,
              name: "完成率",
            },
          ],
        }
      );
    });

    option = {
      title: titleArr,
      series: seriesArr,
    };
    myChart.setOption(option);
  }
}
// 装饰安装工程完成率
decorationInstallationComEchart();
function decorationInstallationComEchart() {
  let decorationInstallationComE = document.getElementsByClassName(
    "decorationInstallationComEchart"
  );
  for (var i = 0; i < decorationInstallationComE.length; i++) {
    let myChart = echarts.init(decorationInstallationComE[i]);
    var demoData = [
      {
        name: "10号线二期",
        unit: "%",
        value: 100,
      },
      {
        name: "14号线",
        unit: "%",
        value: 100,
      },
      {
        name: "15号线",
        unit: "%",
        value: 100,
      },
      {
        name: "18号线",
        unit: "%",
        value: 100,
      },
    ];
    option = {
      series: (function () {
        var result = [];
        demoData.forEach(function (item, index) {
          result.push(
            {
              name: item.name,
              type: "gauge",
              radius: "45%",
              center: [
                index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                index < 2 ? "28%" : "78%",
              ],
              startAngle: 225,
              endAngle: -45,
              min: 0,
              max: 100,
              axisLine: {
                show: true,
                lineStyle: {
                  width: 10,
                  shadowBlur: 0,
                  color: [
                    [0, "transparent"],
                    [0.1, "#194383"],
                    [0.108, "transparent"],
                    [0.2, "#194383"],
                    [0.208, "transparent"],
                    [0.3, "#194383"],
                    [0.308, "transparent"],
                    [0.4, "#194383"],
                    [0.408, "transparent"],
                    [0.5, "#194383"],
                    [0.508, "transparent"],
                    [0.6, "#194383"],
                    [0.608, "transparent"],
                    [0.7, "#194383"],
                    [0.708, "transparent"],
                    [0.8, "#194383"],
                    [0.808, "transparent"],
                    [0.9, "#194383"],
                    [0.908, "transparent"],
                    [1, "#194383"],
                  ],
                },
              },
              axisTick: {
                show: false,
              },
              splitLine: {
                show: 0,
              },
              axisLabel: {
                show: 0,
              },
              pointer: {
                show: false,
              },
              detail: {
                show: false,
              },
              data: [
                {
                  show: false,
                },
              ],
            },
            {
              name: item.name,
              type: "gauge",
              radius: "50%",
              center: [
                index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                index < 2 ? "28%" : "78%",
              ],
              startAngle: 225,
              endAngle: -45,
              min: 0,
              max: 100,
              axisLine: {
                show: true,
                lineStyle: {
                  width: 150,
                  color: [
                    [
                      item.value / 100,
                      new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                        {
                          offset: 0,
                          color: "rgba(69, 161, 255,0)",
                        },
                        {
                          offset: 0.3,
                          color: "rgba(69, 161, 255,0)",
                        },
                        {
                          offset: 1,
                          color: "rgba(69, 161, 255,0.7)",
                        },
                      ]),
                    ],
                    [1, "rgba(28,128,245,.0)"],
                  ],
                },
              },
              axisTick: {
                show: false,
              },
              splitLine: {
                show: 0,
              },
              axisLabel: {
                show: 0,
              },
              pointer: {
                show: false,
                length: "100%",
              },
              detail: {
                show: true,
                offsetCenter: [1, "1%"],
                textStyle: {
                  fontSize: 20,
                  color: "#0AFCE0",
                },
                formatter: ["{value}" + ("%" || "")].join("\n"),
              },
              itemStyle: {
                color: "rgba(28, 128, 245,.3)",
                borderColor: "rgba(28, 128, 245,1)",
              },
              data: [
                {
                  value: item.value,
                },
              ],
            },
            {
              type: "gauge",
              radius: "35%",
              center: [
                index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                index < 2 ? "28%" : "78%",
              ],
              splitNumber: 8,
              min: 0,
              max: 100,
              startAngle: 225,
              endAngle: -45,
              axisLabel: {
                show: false,
              },
              axisLine: {
                show: true,
                lineStyle: {
                  width: 0,
                  color: [
                    [
                      1,
                      new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                        {
                          offset: 1,
                          color: "#194383",
                        },
                        {
                          offset: 1,
                          color: "#194383",
                        },
                      ]),
                    ],
                  ],
                },
              },

              splitLine: {
                show: true,
                length: 10,
                color: "#90D1FE",
              },
              pointer: {
                show: 0,
              },
              detail: {
                show: 0,
              },
            },
            {
              type: "gauge",
              radius: "50%",
              center: [
                index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                index < 2 ? "28%" : "78%",
              ],
              // center: [
              //   index < 2 ? index * 39 + 20 + "%" : index * 45 - 40 + "%",
              //   index < 2 ? "30%" : "75%",
              // ],
              splitNumber: 10,
              splitLine: {
                show: false,
              },
              min: 0,
              max: 100,
              startAngle: 225,
              endAngle: -45,
              axisLabel: {
                show: false,
                textStyle: {
                  fontSize: 12,
                },
              },
              axisLine: {
                show: false,
              },

              pointer: {
                show: 0,
              },
              axisTick: {
                show: false,
              },
              detail: {
                show: true,
                offsetCenter: [0, "50%"],
                formatter: item.name,
                textStyle: {
                  fontSize: 12,
                  color: "#ffffff",
                  lineHeight: 20,
                  fontWeight: "100",
                },
              },
            },
            {
              type: "gauge",
              radius: "50%",
              center: [
                index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                index < 2 ? "28%" : "78%",
              ],
              splitNumber: 10,
              splitLine: {
                show: false,
              },
              min: 0,
              max: 100,
              startAngle: 225,
              endAngle: -45,
              axisLabel: {
                show: false,
              },
              axisLine: {
                show: true,
                lineStyle: {
                  width: 2,
                  shadowBlur: 0,
                  color: [
                    [0.05, "#3F6BFC"],
                    [0.1, "#4072FB"],
                    [0.15, "#4077F9"],
                    [0.2, "#417BF9"],
                    [0.25, "#4282F8"],
                    [0.3, "#4385F7"],
                    [0.35, "#4389F6"],
                    [0.4, "#448FF5"],
                    [0.45, "#4594F4"],
                    [0.5, "#4599F3"],
                    [0.55, "#469EF2"],
                    [0.6, "#46A3F1"],
                    [0.65, "#46A6F0"],
                    [0.7, "#24befe"],
                    [0.75, "#12d1ff"],
                    [0.8, "#06defe"],
                    [0.85, "#05e0ff"],
                    [0.9, "#06deff"],
                    [0.95, "#06deff"],
                    [1, "#06deff"],
                  ],
                },
              },
              pointer: {
                show: 0,
              },
              axisTick: {
                show: false,
              },
              detail: {
                show: false,
              },
            },
            {
              type: "gauge",
              radius: "55%",
              center: [
                index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
                index < 2 ? "28%" : "78%",
              ],
              splitNumber: 10,
              splitLine: {
                show: false,
              },
              min: 0,
              max: 100,
              startAngle: 225,
              endAngle: -45,
              axisLabel: {
                show: false,
              },
              axisLine: {
                show: true,
                lineStyle: {
                  width: 2,
                  shadowBlur: 0,
                  color: [
                    [0.05, "#0A498E"],
                    [0.1, "#0C58A7"],
                    [0.15, "#254DD3"],
                    [0.2, "#355FEC"],
                    [0.25, "#4072FB"],
                    [0.3, "#355FEC"],
                    [0.35, "#254DD3"],
                    [0.4, "#06478B"],
                    [0.45, "#0A246C"],
                    [0.5, "#071848"],
                    [0.55, "#071848"],
                    [0.6, "#0A246C"],
                    [0.65, "#06478B"],
                    [0.7, "#254DD3"],
                    [0.75, "#355FEC"],
                    [0.8, "#355FEC"],
                    [0.85, "#254DD3"],
                    [0.9, "#0C58A7"],
                    [0.95, "#0A498E"],
                    [1, "#0A498E"],
                  ],
                },
              },
              pointer: {
                show: 0,
              },
              axisTick: {
                show: false,
              },
              detail: {
                show: false,
              },
            }
          );
        });

        return result;
      })(),
    };
    myChart.setOption(option);
  }
}
// 机电安装调试完成率
electromechanicalDebuggingEchart();
function electromechanicalDebuggingEchart() {
  let electromechanicalDebuggingE = document.getElementsByClassName(
    "electromechanicalDebuggingEchart"
  );
  for (var i = 0; i < electromechanicalDebuggingE.length; i++) {
    let myChart = echarts.init(electromechanicalDebuggingE[i]);
    var fourPieData = [
      {
        name: "10号线二期",
        value: 90.28,
      },
      {
        name: "14号线",
        value: 3.74,
      },
      {
        name: "15号线",
        value: 42.23,
      },
      {
        name: "18号线",
        value: 0.33,
      },
    ];
    var titleArr = [],
      seriesArr = [];
    fourPieData.forEach(function (item, index) {
      titleArr.push({
        text: item.name,
        left: index < 2 ? index * 50 + 23 + "%" : index * 50 - 77 + "%",
        top: index < 2 ? "42%" : "90%",
        textAlign: "center",
        textStyle: {
          fontWeight: "normal",
          fontSize: "12",
          color: "#fff",
          textAlign: "center",
        },
      });
      seriesArr.push(
        {
          name: item.name,
          type: "pie",
          radius: ["35%", "28%"],
          silent: true,
          clockwise: true,
          startAngle: 90,
          z: 0,
          zlevel: 0,
          label: {
            normal: {
              position: "center",
            },
          },
          center: [
            index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
            index < 2 ? "22%" : "70%",
          ],
          data: [
            {
              value: item.value,
              label: {
                normal: {
                  formatter: function (params) {
                    return params.value + "%";
                  },
                  position: "center",
                  show: true,
                  textStyle: {
                    fontSize: "14",
                    fontWeight: "bold",
                    color: "#fff", //跟随其他颜色
                  },
                },
              },
              itemStyle: {
                normal: {
                  color: {
                    // 完成的圆环的颜色
                    colorStops: [
                      {
                        offset: 0,
                        color: "#4FADFD", // 0% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "#28E8FA", // 100% 处的颜色
                      },
                    ],
                  },
                },
              },
            },
            {
              value: 100 - item.value,
              name: "",
              label: {
                normal: {
                  show: false,
                },
              },
              itemStyle: {
                normal: {
                  color: "#173164",
                },
              },
            },
          ],
        },
        {
          name: "",
          type: "gauge",
          radius: "36%",
          center: [
            index < 2 ? index * 50 + 25 + "%" : index * 50 - 75 + "%",
            index < 2 ? "22%" : "70%",
          ],
          // center: ['90%', '50%'],
          startAngle: 0,
          endAngle: 359.9,
          splitNumber: 8,
          hoverAnimation: true,
          axisTick: {
            show: false,
          },
          splitLine: {
            length: 13,
            lineStyle: {
              width: 2,
              color: "#061740",
            },
          },
          axisLabel: {
            show: false,
          },
          pointer: {
            show: false,
          },
          axisLine: {
            lineStyle: {
              opacity: 0,
            },
          },
          detail: {
            show: false,
          },
          data: [
            {
              value: 0,
              name: "",
            },
          ],
        }
      );
    });
    var option = {
      title: titleArr,
      series: seriesArr,
    };
    myChart.setOption(option);
  }
}

// 试运行完成率
commissioningCompletedEchart();
function commissioningCompletedEchart() {
  let commissioningCompletedE = document.getElementsByClassName(
    "commissioningCompletedEchart"
  );
  for (var i = 0; i < commissioningCompletedE.length; i++) {
    let myChart = echarts.init(commissioningCompletedE[i]);
    // 数据进度值
    var dataArr = 0;
    // if (data == undefined) {
    //   dataArr = 0;
    // }
    var option = {
      title: {
        show: true,
        text: "试运行完成率",
        x: "50%",
        y: "59%",
        z: 8,
        textAlign: "center",
        textStyle: {
          color: "#f1f7fe",
          fontSize: 14,
          fontWeight: "normal",
        },
      },
      series: [
        {
          name: "内部（环形）进度条",
          type: "gauge",
          center: ["50%", "55%"],
          radius: "65%",
          splitNumber: 10,
          axisLine: {
            lineStyle: {
              color: [
                [dataArr / 100, "#458EFD"],
                [1, "#333f54"],
              ],
              width: 14,
            },
          },
          axisLabel: {
            show: false,
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: false,
          },
          pointer: {
            show: false,
          },
        },
        {
          name: "外部刻度",
          type: "gauge",
          center: ["50%", "55%"],
          //  center: ['20%', '50%'],
          radius: "80%",
          min: 0, //最小刻度
          max: 100, //最大刻度
          splitNumber: 10, //刻度数量
          startAngle: 225,
          endAngle: -45,
          axisLine: {
            show: true,
            // 仪表盘刻度线
            lineStyle: {
              width: 2,
              color: [[1, "#333f54"]],
            },
          },
          //仪表盘文字
          axisLabel: {
            show: true,
            color: "#D6F1FF",
            distance: 25,
            formatter: function (v) {
              switch (v + "") {
                case "0":
                  return "0";
                case "10":
                  return "10";
                case "20":
                  return "20";
                case "30":
                  return "30";
                case "40":
                  return "40";
                case "50":
                  return "50";
                case "60":
                  return "60";
                case "70":
                  return "70";
                case "80":
                  return "80";
                case "90":
                  return "90";
                case "100":
                  return "100";
              }
            },
          }, //刻度标签。
          axisTick: {
            show: true,
            splitNumber: 7,
            lineStyle: {
              color: "#3082FE", //用颜色渐变函数不起作用
              width: 2,
            },
            length: -8,
          }, //刻度样式
          splitLine: {
            show: true,
            length: -20,
            lineStyle: {
              color: "#458EFD", //用颜色渐变函数不起作用
            },
          }, //分隔线样式
          detail: {
            show: false,
          },
          pointer: {
            show: false,
          },
        },
        /*内部*/
        {
          type: "pie",
          radius: ["0", "40%"],
          center: ["50%", "55%"],
          z: 8,
          hoverAnimation: false,
          data: [
            {
              name: "检查进度",
              value: dataArr,
              itemStyle: {
                normal: {
                  color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                    {
                      offset: 0,
                      color: "#3398ff",
                    },
                    {
                      offset: 1,
                      color: "#7db0fd",
                    },
                  ]),
                },
              },
              label: {
                normal: {
                  formatter: function (params) {
                    return params.value + "%";
                  },
                  color: "#FFFFFF",
                  fontSize: 30,
                  fontWeight: "bold",
                  position: "center",
                  show: true,
                },
              },
              labelLine: {
                show: false,
              },
            },
          ],
        },
        /*外一层*/
        {
          type: "pie",
          radius: "45%",
          startAngle: 220,
          endAngle: -40,
          hoverAnimation: false,
          center: ["50%", "55%"],
          avoidLabelOverlap: false,
          label: {
            show: false,
          },
          labelLine: {
            show: false,
          },
          data: [
            {
              value: 1,
              itemStyle: {
                normal: {
                  color: "#8DC4FD",
                },
              },
            },
          ],
        },
        //外二层圈
        {
          type: "pie",
          radius: "50%",
          center: ["50%", "55%"],
          avoidLabelOverlap: false,
          z: 0,
          hoverAnimation: false,
          label: {
            show: false,
          },
          labelLine: {
            show: false,
          },
          data: [
            {
              value: 1,
              itemStyle: {
                normal: {
                  color: "#e3edf8",
                },
              },
            },
          ],
        },
      ],
    };
    myChart.setOption(option);
  }
}
//属地化移交完成率
territorialTransferEchart();
function territorialTransferEchart() {
  let territorialTransferE = document.getElementsByClassName(
    "territorialTransferEchart"
  );
  for (var i = 0; i < territorialTransferE.length; i++) {
    let myChart = echarts.init(territorialTransferE[i]);
    let data = [
      {
        name: "实际完成率",
        value: 0,
      },
    ];
    option = {
      series: [
        {
          name: "Indicator",
          type: "gauge",
          endAngle: 0,
          startAngle: 180,
          min: 0,
          max: 100,
          axisLine: {
            show: true,
            lineStyle: {
              width: 30,
              color: [
                // 			颜色渐变函数 前四个参数分别表示四个位置依次为 右上左下
                [
                  0,
                  new echarts.graphic.LinearGradient(
                    0,
                    0,
                    1,
                    0,
                    [
                      {
                        offset: 0,
                        color: "rgba(0, 214, 240, 0.4)", // 0% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "rgba(0, 214, 240, 1)", // 100% 处的颜色
                      },
                    ],
                    false
                  ),
                ],
                [
                  1,
                  new echarts.graphic.LinearGradient(
                    0,
                    1,
                    0,
                    0,
                    [
                      {
                        offset: 0.5,
                        color: "#ccc", // 0% 处的颜色
                      },
                      {
                        offset: 0,
                        color: "#ccc", // 100% 处的颜色
                      },
                    ],
                    false
                  ),
                ],
              ],
            },
          },
          //仪表盘轴线
          axisLabel: {
            show: true,
            color: "#ffffff",
            fontSize: 15,
          },
          title: {
            show: false,
            fontSize: 26,
            color: "#fff",
            offsetCenter: [-48, 40],
          },
          detail: {
            offsetCenter: [0, 40],
            fontSize: 26,
            color: "#fff",
            formatter: function (value) {
              return "实际完成率\r\r{value|" + value + "}\r%";
            },
            rich: {
              value: {
                fontSize: 51,
                color: "rgba(0, 214, 240, 1)",
              },
            },
          },
          data: data,
        },
      ],
    };
    myChart.setOption(option);
  }
}
//市民满意率
publicSatisfactionRateEchart();
function publicSatisfactionRateEchart() {
  let publicSatisfactionRateE = document.getElementsByClassName(
    "publicSatisfactionRateEchart"
  );
  for (var i = 0; i < publicSatisfactionRateE.length; i++) {
    let myChart = echarts.init(publicSatisfactionRateE[i]);
    option = {
      tooltip: {
        trigger: "axis",
        axisPointer: {
          type: "shadow",
          label: {
            show: true,
          },
        },
      },
      grid: {
        left: "10%",
        top: "18%",
        right: "13%",
        bottom: "10%",
      },
      legend: {
        data: ["总数", "满意数", "满意率"],
        top: "2%",
        textStyle: {
          color: "#fff",
          fontSize: 12,
        },
      },
      xAxis: {
        data: ["10号线二期", "14号线", "15号线", "18号线"],
        axisLine: {
          show: true, //隐藏X轴轴线
          lineStyle: {
            color: "#fff",
            width: 1,
          },
        },
        axisTick: {
          show: true, //隐藏X轴刻度
          alignWithLabel: true,
        },
        axisLabel: {
          show: true,
          textStyle: {
            color: "#fff", //X轴文字颜色
            fontSize: 12,
          },
          interval: 0,
          //   rotate: 30,
        },
      },
      yAxis: [
        {
          type: "value",
          name: "数量",
          nameTextStyle: {
            color: "#fff",
            fontSize: 12,
          },
          splitLine: {
            show: true,
            lineStyle: {
              width: 1,
              color: "#3d5269",
            },
          },
          axisTick: {
            show: false,
          },
          axisLine: {
            show: false,
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
              fontSize: 12,
            },
          },
        },
        {
          type: "value",
          name: "满意率%",
          nameTextStyle: {
            color: "#fff",
            fontSize: 12,
          },
          position: "right",
          splitLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
          axisLine: {
            show: false,
            lineStyle: {
              color: "#396A87",
              width: 2,
            },
          },
          axisLabel: {
            show: true,
            formatter: "{value} %", //右侧Y轴文字显示
            textStyle: {
              color: "#fff",
              fontSize: 12,
            },
          },
        },
      ],
      series: [
        {
          name: "总数",
          type: "bar",
          barWidth: 18,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#00FFFF",
                },
                {
                  offset: 1,
                  color: "#0080FF",
                },
              ]),
            },
          },
          data: [10, 30, 31, 21],
        },
        {
          name: "满意数",
          type: "bar",
          barWidth: 18,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#E29052",
                },
                {
                  offset: 1,
                  color: "#FA5A53",
                },
              ]),
            },
          },
          data: [9, 26, 26, 18],
        },
        {
          name: "满意率",
          type: "line",
          yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
          showAllSymbol: true, //显示所有图形。
          symbol: "circle", //标记的图形为实心圆
          symbolSize: 6, //标记的大小
          itemStyle: {
            //折线拐点标志的样式
            color: "#26D9FF",
            borderColor: "#26D9FF",
            width: 2,
            shadowColor: "#26D9FF",
            shadowBlur: 2,
          },
          lineStyle: {
            color: "#26D9FF",
            width: 2,
            shadowBlur: 2,
          },
          data: [90, 87, 84, 86],
        },
      ],
    };
    myChart.setOption(option);
  }
}
//投资完成率
investmentCompletionRateEchart();
function investmentCompletionRateEchart() {
  let investmentCompletionRateE = document.getElementsByClassName(
    "investmentCompletionRateEchart"
  );
  for (var i = 0; i < investmentCompletionRateE.length; i++) {
    let myChart = echarts.init(investmentCompletionRateE[i]);
    let value = 70;
    let title = "投资完成率：62.39%";
    let int = value.toFixed(2).split(".")[0];
    let float = value.toFixed(2).split(".")[1];

    option = {
      backgroundColor: "#081528",
      title: {
        text: title,
        x: "center",
        y: "40%",
        textStyle: {
          color: "#fff",
          fontSize: 16,
          rich: {
            a: {
              fontSize: 12,
              color: "#29EEF3",
            },
            b: {
              fontSize: 12,
              color: "#29EEF3",
              padding: [0, 0, 14, 0],
            },
            c: {
              fontSize: 12,
              color: "#ffffff",
              padding: [5, 0],
            },
            num: {
              fontSize: 12,
              color: "#ffffff",
              padding: [5, 0],
            },
          },
        },
      },
      series: [
        {
          type: "gauge",
          radius: "80%",
          clockwise: false,
          startAngle: "70",
          endAngle: "-269.9999",
          splitNumber: 22,
          detail: {
            offsetCenter: [0, -20],
            formatter: " ",
          },
          pointer: {
            show: false,
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: [
                [0, "#2CFAFC"],
                [
                  (100 - 62.39) / 100,
                  new echarts.graphic.RadialGradient(
                    1,
                    0,
                    1,
                    [
                      {
                        offset: 0,
                        color: "#ffc500",
                      },
                      {
                        offset: 0.5,
                        // color: '#1E2B57'
                        color: "#ffe53a",
                      },
                      {
                        offset: 1,
                        color: "#feef4c",
                        // color:'rgba(17,24,43,0)'
                      },
                    ],
                    false
                  ),
                ],
                [1, "rgba(32,187,252,0.15)"],
              ],
              width: 30,
            },
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: true,
            length: 32,
            lineStyle: {
              color: "#071427",
              width: 2,
            },
          },
          axisLabel: {
            show: false,
          },
          detail: {
            show: true,
            offsetCenter: [15, "120%"],
            color: "#fff",
            formatter: function (params) {
              return "";
            },
            textStyle: {
              fontSize: 34,
            },
          },
        },
        {
          type: "pie",
          name: "总投资：",
          radius: ["54%", "55%"],
          hoverAnimation: false,
          clockWise: false,
          itemStyle: {
            normal: {
              color: "#e8c561",
            },
          },
          label: {
            normal: {
              show: true,
              position: "center",
              padding: [60, 45, 0, 40],
              align: "center",
              width: 70,
              height: 50,
              lineHeight: 14, // 控制\n的行高
              fontSize: 14,
              formatter: function (param) {
                return (
                  "{a| " +
                  param.seriesName +
                  "}" +
                  "{b|" +
                  1387.2 +
                  "亿元" +
                  "}"
                );
              },
              rich: {
                a: {
                  fontSize: 14,
                  color: "#fff",
                  lineHeight: 23,
                },
                b: {
                  fontSize: 14,
                  color: "#ffe900",
                  lineHeight: 23,
                },
              },
            },
          },
          data: [3],
        },
        {
          type: "pie",
          name: "完成额：",
          radius: [0, "50.5%"],
          data: [3],
          hoverAnimation: false,
          clockWise: false,
          itemStyle: {
            normal: {
              color: "#041b2d",
            },
          },
          label: {
            normal: {
              show: true,
              position: "center",
              padding: [80, 45, 0, 40],
              align: "center",
              width: 70,
              height: 20,
              lineHeight: 14, // 控制\n的行高
              fontSize: 30,
              formatter: function (param) {
                return (
                  "{a| " +
                  param.seriesName +
                  "}" +
                  "{b|" +
                  865.48 +
                  "亿元" +
                  "}"
                );
              },
              rich: {
                a: {
                  fontSize: 14,
                  color: "#fff",
                  lineHeight: 23,
                },
                b: {
                  fontSize: 14,
                  color: "#e92438",
                  lineHeight: 23,
                },
              },
            },
          },
        },
      ],
    };
    myChart.setOption(option);
  }
}
// 用款对比
comparisonFundsEchart();
function comparisonFundsEchart() {
  let comparisonFundsE = document.getElementsByClassName(
    "comparisonFundsEchart"
  );
  for (var i = 0; i < comparisonFundsE.length; i++) {
    let myChart = echarts.init(comparisonFundsE[i]);
    var xdata = ["用款/概算比率", "用款/目标成本比率", "用款/合同价比率"];
    var data = [64.08, 68.06, 76.94];
    var maxArr = [100, 100, 100];
    option = {
      // backgroundColor: "rgba(5,39,58,1)", //背景色
      tooltip: {
        trigger: "axis",
        borderRadius: 5,
        borderColor: "#6baab2",
        borderWidth: 1,
        formatter: function (params) {
          // return (
          //   params[0].data.nameCode +
          //   "<br>" +
          //   "杆塔数量(基数) :" +
          //   params[0].value
          // );
        },
      },
      grid: {
        left: "3%",
        right: "3%",
        bottom: "5%",
        top: "10%",
        containLabel: true,
      },
      xAxis: {
        data: xdata,
        triggerEvent: true,
        axisTick: {
          show: false,
        },
        axisLine: {
          show: false,
        },
        axisLabel: {
          show: true,
          //   rotate: 45,
          interval: 0,
          textStyle: {
            color: "#fff",
          },
        },
      },
      yAxis: {
        // name: "单位：%",
        triggerEvent: true,
        // nameTextStyle: {
        //   color: "#fff",
        //   fontSize: 18,
        // },
        splitLine: {
          show: true,
          lineStyle: {
            color: "rgba(255,255,255,.1)",
          },
        },
        axisTick: {
          show: false,
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: "rgba(255,255,255,.1)",
          },
        },
        axisLabel: {
          show: true,
          textStyle: {
            color: "#fff",
            fontSize: 12,
          },
        },
      },
      // color: ["#e54035"],
      series: [
        {
          name: "hill",
          barMinHeight: 10,
          type: "pictorialBar",
          barCategoryGap: "60%",
          // symbol: 'path://M0,10 L10,10 L5,0 L0,10 z',
          symbol: "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z",
          itemStyle: {
            normal: {
              //barBorderRadius: 5,
              //渐变色
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#01EAED",
                },
                {
                  offset: 0.5,
                  color: "#02C4DD",
                },
                {
                  offset: 1,
                  color: "#029ED9",
                },
              ]),
            },
          },
          label: {
            normal: {
              show: true,
              position: "top",
              formatter: "{c}%",
              textStyle: {
                color: "#fff",
                fontSize: 12,
              },
            },
          },
          data: data,
          z: 10,
        },
        // {
        //   name: "hill",
        //   type: "bar",
        //   barWidth: "20%",
        //   symbol: "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z",
        //   itemStyle: {
        //     normal: {
        //       color: "rgba(11,47,68,.8)",
        //     },
        //   },
        //   data: maxArr,
        //   z: 9,
        // },
      ],
    };
    myChart.setOption(option);
  }
}
//历史奖项获得数
awardsHistoryNumEchart();
function awardsHistoryNumEchart() {
  let awardsHistoryNumE = document.getElementsByClassName(
    "awardsHistoryNumEchart"
  );
  for (var i = 0; i < awardsHistoryNumE.length; i++) {
    let myChart = echarts.init(awardsHistoryNumE[i]);
    var fontColor = "#fff";
    var data = [
      {
        name: "世界级奖项",
        value: 1,
      },
      {
        name: "国家级奖项",
        value: 13,
      },
      {
        name: "省部级奖项",
        value: 586,
      },
    ];

    option = {
      color: ["#f9e264", "#5f45ff", "#02cdff"],
      title: {
        text: 600,
        subtext: "获奖总数",
        textStyle: {
          color: "#f2f2f2",
          fontSize: 40,
        },
        subtextStyle: {
          fontSize: 20,
          color: ["#ff9d19"],
        },
        x: "33%",
        y: "38%",
      },
      grid: {
        top: "20%",
      },
      tooltip: {
        trigger: "item",
        formatter: "{b}<br/> {c}  ({d}%)",
      },
      legend: {
        orient: "vertical",
        top: "5%",
        right: "5%",
        textStyle: {
          color: "#f2f2f2",
          fontSize: 12,
        },
        icon: "roundRect",
        data: data,
      },
      series: [
        // 主要展示层的
        {
          radius: ["50%", "70%"],
          center: ["40%", "50%"],
          type: "pie",
          label: {
            position: "inner",
            formatter: "{b}：{c}",
          },
          labelLine: {
            normal: {
              show: true,
              length: 5,
              length2: 5,
            },
            emphasis: {
              show: true,
            },
          },
          data: data,
          itemStyle: {
            emphasis: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: "rgba(0, 0, 0, 0.5)",
            },
            normal: {
              label: {
                show: true,
                formatter: "{b}:\n{c} ({d}%)",
              },
              labelLine: { show: true },
            },
          },
        },
        // 边框的设置
        {
          radius: ["45%", "50%"],
          center: ["40%", "50%"],
          type: "pie",
          label: {
            normal: {
              show: false,
            },
            emphasis: {
              show: false,
            },
          },
          labelLine: {
            normal: {
              show: false,
            },
            emphasis: {
              show: false,
            },
          },
          animation: false,
          tooltip: {
            show: false,
          },
          data: [
            {
              value: 1,
              itemStyle: {
                color: "rgba(250,250,250,0.3)",
              },
            },
          ],
        },
        {
          name: "外边框",
          type: "pie",
          clockWise: false, //顺时加载
          hoverAnimation: false, //鼠标移入变大
          center: ["40%", "50%"],
          radius: ["75%", "75%"],
          label: {
            normal: {
              show: false,
            },
          },
          data: [
            {
              value: 9,
              name: "",
              itemStyle: {
                normal: {
                  borderWidth: 2,
                  borderColor: "#0b5263",
                },
              },
            },
          ],
        },
      ],
    };
    myChart.setOption(option);
  }
}
// 土建工程获奖率
civilEngineeringAwardEchart();
function civilEngineeringAwardEchart() {
  let civilEngineeringAwardE = document.getElementsByClassName(
    "civilEngineeringAwardEchart"
  );
  for (var i = 0; i < civilEngineeringAwardE.length; i++) {
    let myChart = echarts.init(civilEngineeringAwardE[i]);
    var lineColor = "#406A92";
    var labelColor = "#fff";
    var fontSize = "12";
    var lineWidth = 1;
    option = {
      grid: {
        left: "2%",
        right: "5%",
        top: "25%",
        bottom: "4%",
        containLabel: true,
      },
      tooltip: {
        show: true,
        trigger: "axis",
        textStyle: {
          fontSize: fontSize,
        },
      },
      legend: {
        show: true,
        x: "center",
        y: "1%",
        itemWidth: 15,
        itemHeight: 8,
        textStyle: {
          color: "#fff",
          fontSize: fontSize,
        },
        data: ["合格率", "获奖率"],
      },
      xAxis: [
        {
          type: "category",
          name: "",
          nameTextStyle: {
            fontSize: fontSize,
            color: labelColor,
            lineHeight: 90,
          },
          axisLabel: {
            color: labelColor,
            fontSize: fontSize,
            margin: 20,
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: lineColor,
              width: lineWidth,
            },
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: false,
            lineStyle: {
              color: "#197584",
            },
          },
          data: ["10号线二期", "14号线", "15号线", "18号线"],
        },
      ],
      yAxis: [
        {
          type: "value",
          name: "",
          nameTextStyle: {
            fontSize: fontSize,
            color: labelColor,
          },
          nameGap: 10,
          axisLabel: {
            show: false,
            formatter: "{value}",
            margin: 20,
            textStyle: {
              color: labelColor,
              fontSize: fontSize,
            },
          },
          axisLine: {
            show: false,
            lineStyle: {
              color: lineColor,
              width: lineWidth,
            },
          },
          splitArea: {
            show: false,
            areaStyle: {
              color: ["rgba(128,160,176,.1)", "rgba(250,250,250,0)"],
            },
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: false,
            lineStyle: {
              color: lineColor,
            },
          },
        },
      ],
      series: [
        {
          name: "",
          type: "pictorialBar",
          symbolSize: [25, 10],
          symbolOffset: [-22, -6],
          symbolPosition: "end",
          z: 12,
          tooltip: {
            show: false,
          },
          label: {
            normal: {
              show: false,
              position: "top",
              fontSize: fontSize,
              color: "#fff",
            },
          },
          color: "#26B2E8",
          data: [100, 100, 100, 100],
        },
        {
          name: "",
          type: "pictorialBar",
          tooltip: {
            show: false,
          },
          symbolSize: [40, 20],
          symbolOffset: [-22, 15],
          z: 10,
          itemStyle: {
            normal: {
              color: "transparent",
              borderColor: "#2EA9E5",
              borderType: "solid",
              borderWidth: 3,
            },
          },
          data: [100, 100, 100, 100],
        },
        // {
        //   name: "",
        //   type: "pictorialBar",
        //   tooltip: {
        //     show: false,
        //   },
        //   symbolSize: [50, 30],
        //   symbolOffset: [-11, 20],
        //   z: 10,
        //   itemStyle: {
        //     normal: {
        //       color: "transparent",
        //       borderColor: "#26B2E8",
        //       borderType: "solid",
        //       borderWidth: 4,
        //     },
        //   },
        //   data: [100, 100, 100, 100],
        // },
        {
          name: "",
          type: "pictorialBar",
          symbolSize: [30, 15],
          tooltip: {
            show: false,
          },
          symbolOffset: [-22, 10],
          z: 12,
          color: "#26B2E8",
          data: [100, 100, 100, 100],
        },
        {
          type: "bar",
          name: "合格率",
          barWidth: "25",
          barGap: "80%",
          barCateGoryGap: "80%",
          label: {
            normal: {
              show: true,
              position: "top",
              fontSize: fontSize,
              color: "#fff",
              opacity: 1,
              formatter: "{c}%",
              offset: [0, -20],
            },
          },
          itemStyle: {
            normal: {
              color: "#1E93C6",
              opacity: 1,
            },
          },
          data: [100, 100, 100, 100],
        },
        {
          name: "",
          type: "pictorialBar",
          symbolSize: [25, 10],
          symbolOffset: [22, -6],
          symbolPosition: "end",
          z: 12,
          tooltip: {
            show: false,
          },
          label: {
            normal: {
              show: false,
              position: "top",
              fontSize: fontSize,
              color: "#fff",
            },
          },
          color: "#20D3AB",
          data: [75.0, 11.1, 4.8, 5.9],
        },
        {
          name: "",
          type: "pictorialBar",
          tooltip: {
            show: false,
          },
          symbolSize: [40, 20],
          symbolOffset: [22, 15],
          z: 10,
          itemStyle: {
            normal: {
              color: "transparent",
              borderColor: "#20D3AB",
              borderType: "solid",
              borderWidth: 3,
            },
          },
          data: [75.0, 11.1, 4.8, 5.9],
        },
        // {
        //   name: "",
        //   type: "pictorialBar",
        //   tooltip: {
        //     show: false,
        //   },
        //   symbolSize: [90, 40],
        //   symbolOffset: [75, 20],
        //   z: 10,
        //   itemStyle: {
        //     normal: {
        //       color: "transparent",
        //       borderColor: "#20D3AB",
        //       borderType: "solid",
        //       borderWidth: 4,
        //     },
        //   },
        //   data: [75.0, 11.1, 4.8, 5.9],
        // },
        {
          name: "",
          type: "pictorialBar",
          symbolSize: [30, 15],
          tooltip: {
            show: false,
          },
          symbolOffset: [22, 10],
          z: 12,
          color: "#20D3AB",
          data: [75.0, 11.1, 4.8, 5.9],
        },
        {
          type: "bar",
          name: "获奖率",
          barWidth: "25",
          barGap: "80%",
          barCateGoryGap: "80%",
          label: {
            normal: {
              show: true,
              position: "top",
              fontSize: fontSize,
              color: "#fff",
              formatter: "{c}%",
              offset: [0, -20],
            },
          },
          itemStyle: {
            normal: {
              color: "#1AAE96",
              opacity: 1,
            },
          },
          data: [75.0, 11.1, 4.8, 5.9],
        },
      ],
    };
    myChart.setOption(option);
  }
}
//装饰安装工程获奖率
decorationInstallEngEchart();
function decorationInstallEngEchart() {
  let decorationInstallEngE = document.getElementsByClassName(
    "decorationInstallEngEchart"
  );
  for (var i = 0; i < decorationInstallEngE.length; i++) {
    let myChart = echarts.init(decorationInstallEngE[i]);
    var xData = ["10号线二期", "14号线", "15号线", "18号线"];
    var lineData = [100, 100, 100, 100, 100];
    var lastYearData = [100, 100, 100, 100];
    var thisYearData = [0, 0, 0, 0];
    var timeLineData = [1];
    // var bili = [100, 100, 100, 100];
    let legend = ["合格率", "获奖率"];
    let textColor = "#fff";
    let lineColor = "rgba(255,255,255,0.2)";
    let colors = [
      {
        borderColor: "rgba(227,161,96,1)",
        start: "rgba(227,161,96,0.8)",
        end: "rgba(227,161,96,0.3)",
      },
      {
        borderColor: "rgba(0,222,255,1)",
        start: "rgba(0,222,255,0.3)",
        end: "rgba(0,222,255,0.8)",
      },
    ];
    let borderData = [];
    let scale = 2;
    borderData = xData.map((item) => {
      return scale;
    });
    var option = {
      baseOption: {
        timeline: {
          show: false,
          top: 0,
          data: [],
        },
        legend: {
          top: "1%",
          right: "2%",
          itemWidth: 20,
          itemHeight: 5,
          // itemGap: 343,
          icon: "horizontal",
          textStyle: {
            color: "#ffffff",
            fontSize: 12,
          },
          data: legend,
        },
        grid: [
          {
            show: false,
            left: "5%",
            top: "12%",
            bottom: "5%",
            right: "15%",
            containLabel: true,
            width: "37%",
          },
          {
            show: false,
            left: "51.5%",
            top: "14%",
            bottom: "5%",
            width: "0%",
          },
          {
            show: false,
            right: "5%",
            top: "12%",
            bottom: "5%",
            containLabel: true,
            width: "37%",
          },
        ],
        xAxis: [
          {
            type: "value",
            inverse: true,
            axisLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
            position: "top",
            axisLabel: {
              show: true,
              color: textColor,
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: lineColor,
              },
            },
          },
          {
            gridIndex: 1,
            show: false,
          },
          {
            gridIndex: 2,
            axisLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
            position: "top",
            axisLabel: {
              show: true,
              color: textColor,
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: lineColor,
              },
            },
          },
        ],
        yAxis: [
          {
            type: "category",
            inverse: true,
            position: "right",
            axisLine: {
              show: true,
              lineStyle: {
                color: lineColor,
              },
            },

            axisTick: {
              show: false,
            },
            axisLabel: {
              show: false,
            },
            data: xData,
          },
          {
            gridIndex: 1,
            type: "category",
            inverse: true,
            position: "left",
            axisLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
            axisLabel: {
              show: true,
              padding: [30, 0, 0, 0, 20],
              textStyle: {
                color: "#ffffff",
                fontSize: 12,
              },
              align: "center",
            },
            data: xData.map(function (value) {
              return {
                value: value,
                textStyle: {
                  align: "center",
                },
              };
            }),
          },
          {
            gridIndex: 2,
            type: "category",
            inverse: true,
            position: "left",
            axisLine: {
              show: true,
              lineStyle: {
                color: lineColor,
              },
            },
            axisTick: {
              show: false,
            },
            axisLabel: {
              show: false,
            },
            data: xData,
          },
        ],
        series: [],
      },
      options: [],
    };

    option.baseOption.timeline.data.push(timeLineData[0]);
    option.options.push({
      series: [
        {
          name: "合格率	",
          type: "bar",
          barWidth: 25,
          stack: "1",
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                {
                  offset: 0,
                  color: colors[0].start,
                },
                {
                  offset: 1,
                  color: colors[0].end,
                },
              ]),
            },
          },
          label: {
            show: true,
            // position: "top",
            // formatter: "{c}%", //在柱状图的顶部显示出某个东西和这个东西的百分比值
          },
          data: lastYearData,
          animationEasing: "elasticOut",
        },
        {
          name: "合格率",
          type: "bar",
          barWidth: 25,
          stack: "1",
          itemStyle: {
            normal: {
              color: colors[0].borderColor,
            },
          },
          // label: {
          //   show: true,
          //   position: "top",
          //   formatter: "{c}%", //在柱状图的顶部显示出某个东西和这个东西的百分比值
          // },
          data: borderData,
        },
        {
          name: "获奖率",
          type: "bar",
          stack: "2",
          barWidth: 25,
          xAxisIndex: 2,
          yAxisIndex: 2,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                {
                  offset: 0,
                  color: colors[1].start,
                },
                {
                  offset: 1,
                  color: colors[1].end,
                },
              ]),
            },
          },
          label: {
            normal: {
              // show: true,
            },
          },
          data: thisYearData,
          animationEasing: "elasticOut",
        },
        {
          name: "获奖率",
          type: "bar",
          xAxisIndex: 2,
          yAxisIndex: 2,
          barWidth: 25,
          stack: "2",
          itemStyle: {
            normal: {
              color: colors[1].borderColor,
            },
          },
          data: borderData,
        },
      ],
    });
    myChart.setOption(option);
  }
}

//机电系统工程获奖率
electromechanicalAwardsEchart();
function electromechanicalAwardsEchart() {
  let electromechanicalAwardsE = document.getElementsByClassName(
    "electromechanicalAwardsEchart"
  );
  for (var i = 0; i < electromechanicalAwardsE.length; i++) {
    let myChart = echarts.init(electromechanicalAwardsE[i]);
    var colorArr = [
      {
        top: "#FF9A22", //黄色
        bottom: "#FFD56E",
      },
      {
        top: "#2750FF", //蓝色
        bottom: "#6AB4FF",
      },
    ];
    option = {
      grid: {
        top: "10%",
        right: "5%",
        left: "12%",
        bottom: "22%",
      },
      xAxis: [
        {
          type: "category",
          color: "#59588D",
          data: [
            "10号线二期\n合格率",
            "10号线二期\n获奖率",
            "14号线\n合格率",
            "14号线\n获奖率",
            "15号线\n合格率",
            "15号线\n获奖率",
            "18号线\n合格率",
            "18号线\n获奖率",
          ],
          axisLabel: {
            margin: 20,
            interval: 0,
            rotate: 40,
            color: "#fff",
            textStyle: {
              fontSize: 12,
            },
          },
          axisLine: {
            lineStyle: {
              color: "rgba(107,107,107,0.37)",
            },
          },
          axisTick: {
            show: false,
          },
        },
      ],
      yAxis: [
        {
          min: 0,
          max: 100,
          axisLabel: {
            formatter: "{value}%",
            color: "#fff",
            textStyle: {
              fontSize: 12,
            },
          },
          axisLine: {
            lineStyle: {
              color: "rgba(107,107,107,0.37)",
            },
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            lineStyle: {
              color: "rgba(131,101,101,0.2)",
              type: "dashed",
            },
          },
        },
      ],
      series: [
        {
          type: "bar",
          data: [100, 0, 100, 0, 100, 0, 100, 0],
          barWidth: "30px",
          itemStyle: {
            normal: {
              color: function (params) {
                let num = colorArr.length;
                return new echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: colorArr[params.dataIndex % num].top, // 0% 处的颜色
                    },
                    {
                      //可根据具体情况决定哪根柱子显示哪种颜色
                      offset: 1,
                      color: colorArr[params.dataIndex % num].bottom, // 100% 处的颜色
                    },
                  ],
                  false
                );
              },
              barBorderRadius: [30, 30, 0, 0],
            },
          },
          label: {
            normal: {
              show: true,
              fontSize: 12,
              fontWeight: "bold",
              color: "#fff",
              position: "top",
            },
          },
        },
      ],
    };
    myChart.setOption(option);
  }
}
